/**
 * 
 */
package com.mypackage.LocationPattern;

import static android.provider.BaseColumns._ID;
import android.content.Context;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase;
import static com.mypackage.LocationPattern.Constants.*;
/**
 * @author Shawn
 *
 */
public class LocationData extends SQLiteOpenHelper {
	public static final String DATABASE_NAME = "locations.db";
	public static final int DATABASE_VERSION = 1;
	
	public LocationData(Context context){
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}
	
	@Override
	public void onCreate(SQLiteDatabase db){
		db.execSQL("CREATE TABLE " + TABLE_NAME + " (" + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " 
				+ LATITUDE + " REAL, " + LONGITUDE + " REAL, " + HOUR + " INTEGER, "
				+ MINUTE + " INTEGER, " + DAY + "INTEGER);");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
		onCreate(db);
	}
}
